Class : Map
Description
The Map class creates a container and required DOM structure for adding layers, graphics. Typically, a map is added to a page using a DIV. The map's width and height are initialized to those of the DIV container.
Constructors
Name | Summary |
---|---|
Map (container, options?) | Creates a new map inside of the given HTML container, which is often a DIV element. |
Method
Name | Return Type | Summary |
---|---|---|
addLayer(layer) | None | Adds Basemap & Special Layer to the map. |
centerAndZoom(latitude, longitude, level) | None | Set the center and zoom level on the view. |
disableDoubleClickZoom() | None | Disallows double clicking on a map to zoom in a level and center the map. |
getBoundary() | Boundary | Get map extent. |
getLayerIds() | String[] | Returns an all layers of a map. |
getLevel() | Integer | Gets the current level of detail for the map. |
getLayerDetail() | String[] | Gets layer detail such as; default level, default zoom, sort index of layer. |
getScale() | Integer | Get the current scale of the map for display. |
getStyle() | Object | Returns an object that contains the current style information for the layer. |
panTo(latitude, longitude) | None | Centers the map based on map coordinates as the center point. |
print(width, height, dpi, callback) | None | Export the map including visible layers and visible graphics to PNG image. |
removeAllLayers() | None | Removes all layers from the map. |
removeLayer(layerId) | None | Removes the specified layer from the map. |
setExtent(path) | None | Set the extent of the map. |
setFloorPosition(valign, halign, margin) | None | Set floor UI position. |
setLogoPosition(valign, halign, margin) | None | Set logo position. |
setScale(scale) | None | Set extent map scale. For example: 1000, 4000 |
setScalebarPosition(valign, halign, margin) | None | Set scale position. |
setSliderPosition(valign, halign, margin) | None | Set slider position. |
setStyle(styleObject) | None | Changes the style properties used to render the layers. |
setVisibleScalebar(visible) | None | Show or hide Scale bar. |
setVisibleSlider(visible) | None | Show or hide map zoom in/ zoom out element. |
zoomBoundary(boundary) | None | Zoom to specified extent. |
zoomLevel(level) | None | Sets and zoom the map to the specified level. |
zoomToNetworkResult(solveResult) | None | Zoom to the network result. |
zoomToRouteLine(direction) | None | Zoom to the route result. |
zoomToRouteNode(direction, index) | None | Zoom to each node of route. |
Event
Name | Details |
---|---|
onClick | Fires event when single clicks on basemap. |
onDoubleClick | Fires event when double clicks on basemap. |
onLayerRemoveComplate | Fires event when layer has been removed. |
onLayerAddComplete | Fires event when layer has been added to basemap. |
onLoad | Fires when the first or base layer has been successfully added to the map. |
onPan | Fires during the pan process. |
onZoom | Fires during the zoom process. |
Constructor Details
Map(container, option?)
Name | Require | Details | |
---|---|---|---|
container | Require | DIV id element for the referencing map. | |
options | Optional | Optional parameters. See options list. |
Options Properties
Name | Type | Details |
---|---|---|
id | String | Map object ID |
scalebar | Boolean | If true, map scale bar will be visible. |
slider | Boolean | If true, map zoom in/zoom out element will be visible. |
level | Integer | Zoom level. |
lat | double | Latitude in decimal degree. |
lon | double | Longitude in decimal degree. |
country | String | Country code for display basemap. The country codes are support as follow.
|
Method Details
addLayer(layer)
Name | Require | Details | |
---|---|---|---|
<nostra.maps.Layers> layer | Require | NOSTRA Basemap and Special layer. |
centerAndZoom(latitude, longitude, level)
Name | Require | Details | |
---|---|---|---|
<Double> latitude | Require | Latitude in decimal degree. | |
<Double> longitude | Require | Longitude in decimal degree | |
<Integer> level | Require | Zoom level. |
panTo(latitude, longitude)
Name | Require | Details | |
---|---|---|---|
<Double> latitude | Require | Latitude in decimal degree. | |
<Double> longitude | Require | Longitude in decimal degree |
print(width, height, dpi, callback)
Name | Require | Details | |
---|---|---|---|
<Integer> width | Require | Export image width. | |
<Integer> height | Require | Export image height. | |
<Integer> ppi | Require | PPI stands for Pixels Per Inch, Measurements of the pixel density (resolution) of export image. | |
<Functions> callback | Require | The function to call when the method has completed with the resulting export image url. |
removeLayer(layerId)
Name | Require | Details | |
---|---|---|---|
<String> layerId | Require | Layer ID that can get by GetLayer method. |
setExtent(path)
Name | Require | Details | |
---|---|---|---|
<String[][]> path | Require | Two dimension array of latitude and longitude |
setFloorPosition(valign, halign, margin)
Name | Require | Details | |
---|---|---|---|
<String> valign | Require | Vertical position of floor UI. Valid values are: 'TOP', 'BOTTOM'. | |
<String> halign | Require | Horizontal position of floor UI. Valid values are: 'LEFT', 'CENTER', 'RIGHT'. | |
<Integer> margin | Require | Margin of floor UI [left, top, right, bottom]. Example: [5,10,15,5]. |
setLogoPosition(valign, halign, margin)
Name | Require | Details | |
---|---|---|---|
<String> valign | Require | Vertical position of Logo. Valid values are: 'TOP', 'BOTTOM'. | |
<String> halign | Require | Horizontal position of Logo. Valid values are: 'LEFT', 'CENTER', 'RIGHT'. | |
<Integer> margin | Require | Margin of Logo [left, top, right, bottom]. Example: [5,10,15,5]. |
setScale(scale)
Name | Require | Details | |
---|---|---|---|
<Integer> scale | Require | A map scale value greater than 0. |
setScalebarPosition(valign, halign, margin)
Name | Require | Details | |
---|---|---|---|
<String> valign | Require | Vertical position of scalebar. Valid values are: 'TOP', 'BOTTOM'. | |
<String> halign | Require | Horizontal position of scalebar. Valid values are: 'LEFT', 'CENTER', 'RIGHT'. | |
<Integer> margin | Require | Margin of scalebar [left, top, right, bottom]. Example: [5,10,15,5]. |
setSliderPosition(valign, halign, margin)
Name | Require | Details | |
---|---|---|---|
<String> valign | Require | Vertical position of slider. Valid values are: 'TOP', 'BOTTOM'. | |
<String> halign | Require | Horizontal position of slider. Valid values are: 'LEFT', 'CENTER', 'RIGHT'. | |
<Integer> margin | Require | Margin of slider [left, top, right, bottom]. Example: [5,10,15,5]. |
setVisibleScalebar(visible)
Name | Require | Details | |
---|---|---|---|
<Boolean> visible | Require | If true, map scale bar will be visible. |
setVisibleSlider(visible)
Name | Require | Details | |
---|---|---|---|
<Boolean> visible | Require | If true, map zoom in/zoom out element will be visible. |
zoomBoundary(boundary)
Name | Require | Details | |
---|---|---|---|
<Boundary> boundary | Require | JSON object contain geometry information. |
zoomLevel(level)
Name | Require | Details | |
---|---|---|---|
<Integer> level | Require | Zoom level. |
zoomToNetworkResult(solveResult)
Name | Require | Details | |
---|---|---|---|
<SolveResult> solveResult | Require | JSON object contain returned result from network analysis; for example service area, closest facility. |
zoomToRouteLine(direction, index)
Name | Require | Details | |
---|---|---|---|
<Direction> direction | Require | JSON object contain returned route result. | |
<Integer> index | Require | Index node of direction. |
zoomToRouteNode(direction)
Name | Require | Details | |
---|---|---|---|
<Direction> direction | Require | JSON object contain returned route result. |